<include file="Layout/header" />
<body>
<div class="breadcrumbs" id="breadcrumbs"> 
  <script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>
  <ul class="breadcrumb">
    <li> <i class="icon-home home-icon"></i> <a href="{:U('Admin/Index/welcome')}">首页</a> </li>
    <li class="active">会员管理</li>
  </ul>
</div>
<div class="page-content">
  <div class="page-header">
    <h1> 会员管理 <small> <i class="icon-double-angle-right"></i> 代理申请列表 </small> </h1>
  </div>
  <div class="row">
    <form method="get" action="{:U('Admin/Member/examine')}">
      <table class="table table-striped table-bordered table-hover table-condensed">
        <tr>
           <td width="15%"><input class="col-xs-12 col-sm-8" type="text" name="member_name" placeholder="会员名称/手机号码"></td>
          
          <th width="10%"> <select class="input-medium"  name="status">
              <option value="">审核状态</option>
                <option value="0" <?php if($_GET['status']=='0'){?>  selected = "selected"  <?php } ?>>未审核</option>
                <option value="1" <?php if($_GET['status']=='1'){?>  selected = "selected"  <?php } ?>>通过</option>
                <option value="2" <?php if($_GET['status']=='2'){?>  selected = "selected"  <?php } ?>>拒绝</option>
            </select>
          </th>
          
          
          <th width="30%"> 
            <div class="col-xs-3">
              <div class="input-group input-group-sm">
                <input id="datepicker" class="form-control hasDatepicker" name="strtime" type="text" value="<?php echo $_GET['strtime'];?>">
                <span class="input-group-addon"> <i class="icon-calendar"></i> </span> </div>
             </div>
             <div class="col-xs-1" style="padding: 5px 18px;">至</div>
             <div class="col-xs-3">
              <div class="input-group input-group-sm">
                <input id="datepicker1" class="form-control hasDatepicker" name="endtime" type="text" value="<?php echo $_GET['endtime'];?>">
                <span class="input-group-addon"> <i class="icon-calendar"></i> </span> </div>
             </div> 
           
          </th>
          <td width="20%"><input class="btn btn-success" type="submit" value="搜索"></td>
        </tr>
      </table>
    </form>
    <div class="col-xs-12">
   <div class="table-responsive">
        <table id="sample-table-1" class="table table-striped table-bordered table-hover">
          <thead>
            <tr>
              <th class="center"> <label>
                  <input class="ace" type="checkbox">
                  <span class="lbl"></span> </label>
              </th>
              <th>ID</th>
              <th>会员名称/真实姓名</th>
             
              <th>申请理由</th>
              <th>申请时间</th>
            
              <th>审核状态</th>
              <th>操作</th>
            </tr>
          </thead>
          <tbody>
          <form method="post" action="{:U('Admin/Member/detadel')}" id="ondel">
            <foreach name="list" item="val">
              <tr class="selected">
                <td class="center"><label>
                    <input class="ace" type="checkbox" value="{$val.id}" name="id[]">
                    <span class="lbl"></span> </label></td>
                <td>{$val.id}</td>
                <td>{$val.member_name}</td>
                <td>{$val.remark}</td>
             
                <td><?php echo date('Y-m-d H:i:s',$val['add_time']);?></td>
             
                <td class="td-status"><if condition="$val.status eq '1'"> <span class="label label-sm label-success">通过</span>
				   <elseif condition="$val.status eq '2'" />
				   <span class="label label-sm label-error">拒绝</span>
                    <elseif condition="$val.status eq '0'" />
                    <span class="label label-sm label-inverse arrowed-in">未审核</span> </if>
                    </td>
                <td><div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
                    <if condition="$val.status eq '1'"> 
					<a class="btn btn-xs btn-inverse" onClick="member_stop(this,{$val.id},'{$val.remark}')" href="javascript:;"> <i class=" icon-ban-circle bigger-120"></i> </a>
                     

					 <else/>
                     	<a class="btn btn-xs btn-inverse" onClick="member_stop(this,{$val.id},'{$val.remark}')" href="javascript:;"> <i class=" icon-ban-circle bigger-120"></i> </a>
                     
 </if>
                  
					<a class="btn btn-xs btn-danger" onClick="member_del(this,{$val.id})"> <i class="icon-trash bigger-120"></i> </a> </div></td>
              </tr>
            </foreach>
          </form>
            </tbody>
          
        </table>
        <div>
          <button class="btn btn-danger" onClick="datadel()">批量删除</button>
        </div>
      </div>
      <input type="hidden" value="{:U('Admin/Member/member_show')}" id="member_show">
      <input type="hidden" value="{:U('Admin/Member/examine_del')}" id="member_del">
      <!-- /.table-responsive --> 
    </div>
    <div >{$page}</div>
  </div>
</div>

<div class="modal fade" id="bjy-edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> &times;</button>
        <h4 class="modal-title" id="myModalLabel"> 审核</h4>
      </div>
      <div class="modal-body">
        <form id="bjy-form" class="form-inline" action="{:U('Admin/Member/examine_audit')}" method="post">
          <input type="hidden" name="id" value="">
          <table class="table table-striped table-bordered table-hover table-condensed">
          <tr>
              <th>申请理由理由：</th>
              <td id="remark"></td>
            </tr>
            <tr>
              <th>拒绝理由：</th>
              <td><input class="form-control" type="text" name="reason">拒绝通过，请填写理由
                </td>
            </tr>
			 <tr>
              <th>审核状态：</th>
              <td><select class="input-medium" name="status">
              
                <option value="0">未审核</option>
                <option value="1">通过</option>
                <option value="2">拒绝</option>
            </select>
                </td>
            </tr>
            <tr>
              <th></th>
              <td><input class="btn btn-success" type="submit" value="确认"></td>
            </tr>
          </table>
        </form>
      </div>
    </div>
  </div>
</div>
<include file="Layout/js"/> 
<link href="__ADMIN_CSS__/datepicker.css" rel="stylesheet" />
<script src="__ADMIN_JS__/date-time/bootstrap-datepicker.min.js"></script>
<script src="__ADMIN_JS__/jquery.ui.touch-punch.min.js"></script>
<script src="__ADMIN_JS__/jquery.dataTables.min.js"></script> 
<script src="__ADMIN_JS__/jquery.dataTables.bootstrap.js"></script> 
<script src="__ADMIN_JS__/bootbox.js"></script> 
<script type="text/javascript">
			jQuery(function($) {
				$("#datepicker").datepicker({
					showOtherMonths: true,
					selectOtherMonths: false,
					 
				});
				 
				$("#datepicker1").datepicker({
					showOtherMonths: true,
					selectOtherMonths: false,
					 
				}); 
				
				var oTable1 = $('#sample-table-2').dataTable( {
				"aoColumns": [
			      { "bSortable": false },
			      null, null,null, null, null,
				  { "bSortable": false }
				] } );
				
				
				$('table th input:checkbox').on('click' , function(){
					var that = this;
					$(this).closest('table').find('tr > td:first-child input:checkbox')
					.each(function(){
						this.checked = that.checked;
						$(this).closest('tr').toggleClass('selected');
					});
						
				});
			
  				
			})
 		</script> 
<script type="text/javascript">   

// 审核
function member_stop(obj,id,remark){
	
	$("#remark").html(remark);
	$("input[name='id']").val(id);
	$('#bjy-edit').modal('show');
}    
    /*代理-删除*/
function member_del(obj,id){
	var host=$("#member_del").val();
      bootbox.setLocale("zh_CN");  
      bootbox.confirm("确定删除该代理申请?", function(result) {  
        if (result) {
           $.ajax({
			url:host,
			type:"POST",
			dataType:"json",
			data:{id:id},
			success: function(s){
 				if(s.status == '1'){
				$(obj).parents("tr").remove();
				bootbox.alert('删除成功');
				}else{
				bootbox.alert(s.info);	
					}
				}
			})
		
		 
        }  
      });  
 
}
/*批量-删除*/
function datadel(){
	 var is_check=$("input[type='checkbox']").is(':checked');
   if(is_check){
	    bootbox.setLocale("zh_CN");  
      bootbox.confirm("确定删除该会员?", function(result) {  
        if (result) {  
           $("#ondel").submit();
         }  
      });  
    }else{
      bootbox.alert({  
            buttons: {  
               ok: {  
                    label: '返回',  
                    className: 'btn-myStyle'  
                }  
            },  
            message: '请选择要删除的会员',  
            callback: function() {  
               // alert('关闭了alert');  
            },  
            title: "提示信息",  
        });


    }
	 
	
}
 </script>
</body>
</html>